﻿<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             x:Class="Twilight.App"
             xmlns:tc="clr-namespace:Twilight.Controls"
             >
    <Application.Resources>
        <Style x:Key="TweetText" TargetType="TextBlock">
            <Setter Property="FontSize" Value="10.666" />
            <Setter Property="Foreground" Value="#E5000000" />
        </Style>
        <Style x:Key="TweetLink" TargetType="HyperlinkButton">
            <Setter Property="FontSize" Value="10.666" />
        </Style>
        <Style x:Key="LightInfoText" TargetType="TextBlock">
            <Setter Property="FontSize" Value="10.666" />
            <Setter Property="Foreground" Value="#A5FFFFFF" />
        </Style>
        <Style x:Key="LightInfoLink" TargetType="HyperlinkButton">
            <Setter Property="FontSize" Value="10.666" />
            <Setter Property="Foreground" Value="#A5FFFFFF" />
        </Style>
        <Style x:Key="InfoText" TargetType="TextBlock">
            <Setter Property="FontSize" Value="10.666" />
            <Setter Property="Foreground" Value="#A5000000" />
        </Style>
        <Style x:Key="InfoLink" TargetType="HyperlinkButton">
            <Setter Property="FontSize" Value="10.666" />
            <Setter Property="Foreground" Value="#A5000000" />
        </Style>
    	<LinearGradientBrush x:Key="tweetBack" EndPoint="0.5,1" StartPoint="0.5,0">
    		<GradientStop Color="#FFCCCCCC" Offset="1"/>
    		<GradientStop Color="#FFFFFFFF" Offset="0.2"/>
    	</LinearGradientBrush>
        <LinearGradientBrush x:Key="darkBack" EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FF000000"/>
            <GradientStop Color="#FFCCCCCC" Offset="1"/>
        </LinearGradientBrush>
        <ControlTemplate x:Key='FeedListBox' TargetType='ListBox'>
            <ScrollViewer Template='{StaticResource FeedScrollViewer}' Margin='{TemplateBinding Padding}'>
                <ItemsPresenter />
            </ScrollViewer>
        </ControlTemplate>
        <ControlTemplate TargetType='ScrollViewer' x:Key='FeedScrollViewer'>
            <Grid> 
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width='*'/>
                    <ColumnDefinition Width='Auto'/>
                </Grid.ColumnDefinitions>
                <ScrollContentPresenter x:Name="ScrollContentPresenter" Grid.Column="0" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                <ScrollBar x:Name='VerticalScrollBar' Style='{StaticResource SimpleScrollBar}' Grid.Column='1' Orientation='Vertical' Visibility='Visible' ViewportSize='{TemplateBinding ViewportHeight}' Minimum='0' Maximum='{TemplateBinding ScrollableHeight}' Value='{TemplateBinding VerticalOffset}' Width='14'/>
            </Grid>
        </ControlTemplate>
        <Style x:Key='SimpleScrollBar' TargetType='ScrollBar'>
            <Setter Property='Template'>
                <Setter.Value>
                    <ControlTemplate TargetType='ScrollBar'>
                        <Grid x:Name='RootElement'>
                            <Grid.Resources>
                                <ControlTemplate x:Key='RepeatButtonTemplate'>
                                    <Grid x:Name='RootElement' Background='Transparent'/>
                                </ControlTemplate>
                                <ControlTemplate x:Key='VerticalThumbTemplate' TargetType='Thumb'>
                                    <Grid x:Name='RootElement'>
                                        <Rectangle x:Name='ThumbVisual' Margin='3,0,4,0' RadiusX='4' RadiusY='4' Fill='#FFFFFFFF' Opacity="0.6"/>
                                    </Grid>
                                </ControlTemplate>
                            </Grid.Resources>
                            <Grid x:Name='HorizontalRoot' Visibility='Collapsed'/>
                            <Grid x:Name='VerticalRoot'>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height='Auto'/>
                                    <RowDefinition Height='Auto'/>
                                    <RowDefinition Height='*'/>
                                </Grid.RowDefinitions>
                                <Border Grid.RowSpan='3' Background='#00FFFFFF' CornerRadius='0,7,0,0'/>
                                <RepeatButton x:Name='VerticalLargeDecrease' Grid.Row='0' Height='0' Template='{StaticResource RepeatButtonTemplate}' Interval='50' IsTabStop='False'/>
                                <Thumb x:Name='VerticalThumb' MinHeight='10' Height='20' Grid.Row='1' Template='{StaticResource VerticalThumbTemplate}' />
                                <RepeatButton x:Name='VerticalLargeIncrease' Grid.Row='2' Template='{StaticResource RepeatButtonTemplate}' Interval='50' IsTabStop='False'/>
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <ControlTemplate x:Key='FeedItemTemplate' TargetType='ListBoxItem'>
            <Grid Background='Transparent' MinHeight='35' Margin="0,8,0,4">
                <Rectangle Stroke="#FF1A2943" StrokeThickness="1" RadiusX="2" RadiusY="2" Opacity="0.8" Fill="{StaticResource tweetBack}"/>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <tc:TweetBlock Grid.Row="0" Text="{Binding text}" Margin="5,0,0,0" TextStyle="{StaticResource TweetText}" LinkStyle="{StaticResource TweetLink}" />
                    <tc:TweetInfo Grid.Row="1" PostDate="{Binding created_at}" From="{Binding source}" Margin="5,0,0,0" TextStyle="{StaticResource InfoText}" LinkStyle="{StaticResource InfoLink}"/>
                </Grid>
            </Grid>
        </ControlTemplate>
        <Style TargetType='ListBoxItem' x:Key='FeedItemContainerStyle'>
            <Setter Property='Template' Value='{StaticResource FeedItemTemplate}'/>
        </Style>
    </Application.Resources>
</Application>
